<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../css/own.css" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-icon-back mui-icon"></a>
			<h1 class="mui-title">登录</h1>
		</header>
		<div class="mui-content">
			<ul class="mui-list-unstyled">
				<li class="mui-list-unstyled own-margin-left own-margin-right">
					<label>用户名:</label>
					<input placeholder="请输入用户名" type="text" name="user_name" />
				</li>
				<li class="mui-list-unstyled own-margin-left own-margin-right">
					<label>密码:</label>
					<input placeholder="请输入用户密码" type="password" name="password" />
				</li>
			</ul>
			<button class="mui-btn-blue own-margin-left">登录</button>
			<button class="mui-btn-green mui-pull-right own-margin-right">注册</button>

		</div>
		<script src="../js/mui.min.js"></script>
		<script type="text/javascript">
			mui.init({
				preloadPages: [{
					url: 'register.html',
					id: 'register_new',
				}]
			})
			mui.plusReady(function() {
				plus.webview.currentWebview().opener().close("none");
				
				var user_name = document.querySelectorAll('input')[0];
				var user_password = document.querySelectorAll('input')[1];

				mui(document.body).on('click', '.mui-btn-blue', function() {
					//					if(user_name.value == '') {
					//						mui.toast('用户名不能为空！')
					//						return
					//					}
					//					if(user_password.value == '') {
					//						mui.toast('密码不能为空！')
					//						return
					//					}
					mui.get('https://www.baidu.com', {
						userName: user_name.value,
						userPassword: user_password.value,
					}, function(data) {
						localStorage.setItem('st_user_name', user_name.value);
						mui.openWindow('main.html', 'index_new');
					})
				})

				mui(document.body).on('click', '.mui-btn-green', function() {
					mui.openWindow({
						id: 'register_new',
						url: 'register.html',
						show: {
							autoshow: false
						}
					})
				})

			})
		</script>
	</body>

</html>